package com.shanzmoo.db.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shanzmoo.db.sys.entity.SysBillCountEntity;
import com.shanzmoo.db.sys.entity.vo.SysBillCountVO;
import com.shanzmoo.db.sys.entity.query.SysBillCountQuery;
import com.shanzmoo.db.sys.mapper.SysBillCountMapper;
import com.shanzmoo.db.sys.service.ISysBillCountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 系统单号计数表 服务实现类
 *
 * @author Gzhao 2021-03-04
 */
@Service
public class SysBillCountServiceImpl extends ServiceImpl<SysBillCountMapper, SysBillCountEntity>
        implements ISysBillCountService {

    @Override
    public List<SysBillCountVO> queryPageList(SysBillCountQuery query) {
        return baseMapper.queryPageList(query);
    }

    @Override
    public SysBillCountEntity getByBillType(Integer billType) {
        return baseMapper.selectOne(
                new QueryWrapper<SysBillCountEntity>()
                        .eq("bill_type", billType)
        );
    }

    @Override
    public void updateBillCount(Integer billType) {
        baseMapper.updateBillCount(billType);
    }
}
